package com.atdel.demo06;


import java.util.Arrays;
import java.util.List;

/**
 * @BelongsProject: java_study
 * @BelongsPackage: com.atdel.demo06
 * @Author: Del
 * @CreateTime: 2025-03-04  15:49
 * @Description: TODO
 * @Version: 1.0
 */
public class MainTest02 {
    public static void main(String[] args) {
        // 创建门和汽车
        Door jadeIron = new JadeIronDoor();
        Door peachWood = new PeachWoodDoor();
        Car car = new Car();


        // 用户操作
        User user = new User(Arrays.asList(jadeIron, peachWood));
        user.operateDoors(true); // 打开门
        user.operateDoors(false); // 关闭门


        // 天师使用高级策略
        Priest priest = new Priest(new AdvancedStrategy());
        priest.useTool(new PeachWoodDoor());
        priest.useTool(new JadeIronDoor());


        // 小偷偷盗
        Thief thief = new Thief();
        System.out.println("盗窃铁玉门：" + thief.steal(jadeIron));
        System.out.println("盗窃桃木门：" + thief.steal(peachWood)); // 失败
        System.out.println("盗窃汽车：" + thief.steal(car));
    }
}
